Optimal. Leaf size=164 \[ \frac {(B+i A) (a+i a \tan (c+d x))^n \, _2F_1\left (1,n;n+1;\frac {1}{2} (i \tan (c+d x)+1)\right )}{2 d n}-\frac {(B n+i A (n+2)) (a+i a \tan (c+d x))^{n+1}}{a d (n+1) (n+2)}+\frac {B \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (n+2)}-\frac {2 B (a+i a \tan (c+d x))^n}{d n (n+2)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.31, antiderivative size = 164, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {3597, 3592, 3527, 3481, 68} \[ \frac {(B+i A) (a+i a \tan (c+d x))^n \, _2F_1\left (1,n;n+1;\frac {1}{2} (i \tan (c+d x)+1)\right )}{2 d n}-\frac {(B n+i A (n+2)) (a+i a \tan (c+d x))^{n+1}}{a d (n+1) (n+2)}+\frac {B \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (n+2)}-\frac {2 B (a+i a \tan (c+d x))^n}{d n (n+2)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 68
Rule 3481
Rule 3527
Rule 3592
Rule 3597
Rubi steps
\begin {align*} \int \tan ^2(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx &=\frac {B \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n)}+\frac {\int \tan (c+d x) (a+i a \tan (c+d x))^n (-2 a B-a (i B n-A (2+n)) \tan (c+d x)) \, dx}{a (2+n)}\\ &=\frac {B \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n)}-\frac {(B n+i A (2+n)) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n)}+\frac {\int (a+i a \tan (c+d x))^n (a (i B n-A (2+n))-2 a B \tan (c+d x)) \, dx}{a (2+n)}\\ &=-\frac {2 B (a+i a \tan (c+d x))^n}{d n (2+n)}+\frac {B \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n)}-\frac {(B n+i A (2+n)) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n)}+(-A+i B) \int (a+i a \tan (c+d x))^n \, dx\\ &=-\frac {2 B (a+i a \tan (c+d x))^n}{d n (2+n)}+\frac {B \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n)}-\frac {(B n+i A (2+n)) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n)}+\frac {(a (i A+B)) \operatorname {Subst}\left (\int \frac {(a+x)^{-1+n}}{a-x} \, dx,x,i a \tan (c+d x)\right )}{d}\\ &=-\frac {2 B (a+i a \tan (c+d x))^n}{d n (2+n)}+\frac {(i A+B) \, _2F_1\left (1,n;1+n;\frac {1}{2} (1+i \tan (c+d x))\right ) (a+i a \tan (c+d x))^n}{2 d n}+\frac {B \tan ^2(c+d x) (a+i a \tan (c+d x))^n}{d (2+n)}-\frac {(B n+i A (2+n)) (a+i a \tan (c+d x))^{1+n}}{a d (1+n) (2+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [F] time = 22.69, size = 0, normalized size = 0.00 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx \]
Verification is Not applicable to the result.
[In]
[Out]
________________________________________________________________________________________
fricas [F] time = 0.66, size = 0, normalized size = 0.00 \[ {\rm integral}\left (-\frac {{\left ({\left (A - i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} - {\left (A - 3 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} - {\left (A + 3 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + A + i \, B\right )} \left (\frac {2 \, a e^{\left (2 i \, d x + 2 i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{n}}{e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, e^{\left (2 i \, d x + 2 i \, c\right )} + 1}, x\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (B \tan \left (d x + c\right ) + A\right )} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \tan \left (d x + c\right )^{2}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [F] time = 5.48, size = 0, normalized size = 0.00 \[ \int \left (\tan ^{2}\left (d x +c \right )\right ) \left (a +i a \tan \left (d x +c \right )\right )^{n} \left (A +B \tan \left (d x +c \right )\right )\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (B \tan \left (d x + c\right ) + A\right )} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \tan \left (d x + c\right )^{2}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.01 \[ \int {\mathrm {tan}\left (c+d\,x\right )}^2\,\left (A+B\,\mathrm {tan}\left (c+d\,x\right )\right )\,{\left (a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}^n \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (i a \left (\tan {\left (c + d x \right )} - i\right )\right )^{n} \left (A + B \tan {\left (c + d x \right )}\right ) \tan ^{2}{\left (c + d x \right )}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________